package edu.ynu.MyProject.entity;

import edu.ynu.MyProject.common.controller.LogicController;
import edu.ynu.MyProject.common.entity.BaseEntity;
import edu.ynu.MyProject.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;
import org.springframework.util.DigestUtils;
import javax.persistence.Column;
import javax.persistence.Entity;

@Getter
@Setter
@Entity
@Where(clause = "is_deleted = 0")
public class User extends LogicEntity {
    @Column
    protected String username;

    @Column
    protected String password;

    public void setPassword(String psd){
        this.password = DigestUtils.md5DigestAsHex(psd.getBytes());
    }
}
